#ifndef NETWORKPLAYER_H
#define NETWORKPLAYER_H

#include <game/player.h>

class QUdpSocket;

class NetworkPlayer : public Player
{
    Q_OBJECT;
public:
    NetworkPlayer(PWorld *world, PVector startPos, double startAngle, QString name, QObject *parent = 0, bool createShip = true);
    NetworkPlayer(Player *player, PWorld *world);

    void serialize(QDomDocument *doc, QDomElement *e) const;

    static NetworkPlayer *deserialize(QDomNode e, PWorld *world);

    QString getType() const;

    void setSocket(QUdpSocket *socket);

    void setKeys(Qt::Key up, Qt::Key down, Qt::Key right, Qt::Key left);

private slots:
    void readPendingDatagramms();

private:
    Qt::Key myKeyUp;
    Qt::Key myKeyDown;
    Qt::Key myKeyRight;
    Qt::Key myKeyLeft;
//    KeyManager *myKeyManager;

    QUdpSocket *mySocket;
};

#endif // NETWORKPLAYER_H
